home *** CD-ROM | disk | FTP | other *** search
/ Star Festival... a Return to Japan / Star Festival... a Return to Japan.iso / pc / STARFESTIVAL / Shared.Cst / 00134.ls < prev    next >
Encoding:
Text File  |  1999-10-10  |  2.7 KB  |  85 lines

  1. --Note:  This is called from a score script in "starfest0.dir," the projector, because
  2. --       it needs to execute after the sound has started, so the user doesn't 
  3. --       think that nothing is happening.  It is called from handler "sharedstartMovie."
  4. on initFieldNotes
  5.   global gFieldNoteList
  6.   
  7.   preLoadMember member "01 text" of castLib "shared",  member "19 text" of castLib "shared"
  8.   set gFieldNoteList = []
  9.   set saveDelim = the itemDelimiter
  10.   set the itemDelimiter = "*"
  11.   repeat with i = 1 to 19
  12.     if (i < 10) then 
  13.       set aName = "0" & i & " text"
  14.     else
  15.       set aName = i & " text"
  16.     end if
  17.     set myLineHeight = the lineHeight of field aName
  18.     set theText = the text of field aName
  19.     set nItems = the number of items in theText
  20.     set oldCharPos = -100 -- Don't want 0, cause it will make one of the following tests fail
  21.     set thisList = []
  22.     repeat with j = 2 to nItems
  23.       if (j = 2) then
  24.         set myChar = 1
  25.       else if (j = 3) then
  26.         set myChar = length(item 2 of theText) + 2
  27.       else
  28.         set myChar = length(item 2 to (j-1) of theText) + 2
  29.       end if
  30.       set myCharPos = (the locV of charPosToLoc(member aName of castLib "shared", myChar))
  31.       if (myCharPos <> oldCharPos + myLineHeight) then
  32.         set scrollPixel = myCharPos - myLineHeight + 1
  33.       end if
  34.       set myWord = line 1 of (item j of theText)
  35.       set the itemDelimiter = ":"
  36.       set myWord = item 1 of myWord
  37.       set the itemDelimiter = "*"
  38.       addAt(thisList,j,[myWord,myChar,scrollPixel])
  39.       set oldCharPos = myCharPos
  40.     end repeat
  41.     if ( count(thisList) > 0 ) then
  42.       deleteAt(thisList,1)
  43.     end if
  44.     addAt(gFieldNoteList,i,thisList)
  45.   end repeat
  46.   set the itemDelimiter = saveDelim
  47.   
  48. end initFieldNotes
  49.  
  50.  
  51. on getScrollPixel aSite,aPhrase
  52.   global gFieldNoteList
  53.   
  54.   set retVal = -1
  55.   set thisSitesList = getAt(gFieldNoteList,aSite)
  56.   repeat with i = 1 to count(thisSitesList)
  57.     set phraseDataList = getAt(thisSitesList,i)
  58.     set cmpWord = getAt(phraseDataList,1)
  59.     if (cmpWord contains aPhrase) then
  60.       set retVal = getAt(phraseDataList,3)
  61.       exit repeat
  62.     end if
  63.   end repeat
  64.   if (retVal = -1) then
  65.     put "Field Note Error: Couldn't find search word |" & aPhrase & "| in site " & aSite
  66.     set retVal = 0
  67.   end if
  68.   return (retVal)
  69. end getScrollPixel
  70.  
  71.  
  72. on findScroll
  73.   global gSearchTextCast, gFindText
  74.   
  75.   if (not (objectP(gSearchTextCast))) then
  76.     set gSearchTextCast = member (chars(the movieName,1,2) && "TEXT") of castLib "Shared"
  77.   end if
  78.   
  79.   set mySite = the memberNum of gSearchTextCast - 440
  80.   set myPix = getScrollPixel(mySite,gFindText)
  81.   set the scrollTop of member gSearchTextCast of castLib "Shared" = myPix
  82.   
  83.   set gSearchTextCast = EMPTY
  84.   set gFindText = EMPTY
  85. end findScroll